<?php

namespace App\Models\Bus;

use App\Models\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class BusIsCheck extends Model
{
    protected $table = 'akbus_bus_is_check';

    protected $fillable = [
        'bus_id',
        'month',
        'is_check',
    ];
    /**
     * 类型转化
     *
     * @var array
     */
    protected $casts = [
    ];

    public function bus(): BelongsTo
    {
        return $this->belongsTo(Bus::class);
    }

    /**
     * 拼接车牌号字符
     *
     * @param  string  $value
     *
     * @return string
     */
    public function getMonthAttribute($value)
    {
        return date('Y-m', strtotime($value));
    }
}
